home *** CD-ROM | disk | FTP | other *** search
- Keys : AMM,AMS,FILE,FORMAT
-
- Text by "mingo@n3.com.br" Eduardo Motta Buhrnheim (Mingo)
- & "kenfoo@techm.pl.my" Kenneth Foo (TechnoMaestro).
-
- AMM (Audio Manager Module) & AMS (Audio Manager Sample) Formats by
- TechnoMaestro/RDG (1995).
-
- NOTE: Document partially taken from Platinum Play III, a
- SoundBlaster-only MOD/S3M/AMM player, PP3.ZIP.
-
- Below are the file formats supported by AudioManager 3.x and Platinum
- Play III. This DOC is meant for programmers only. (AMM is basically, an
- S3M module clone format, with several enhancements).
-
- PROS:
- - It's supports what S3M, MOD, 669, MTM ... can do. Except some
- formats, like XM.
- - It's usually smaller, and compresses quite well.
-
- CONS:
- - It's proprietary, and thus, there's little support.
- - Not easy to implement
-
- TERMS USED:
- Track = Channel
-
-
- AUDIO MANAGER MODULE (AMM)
- Bytes │ Stuff
- ──────┼───────────────────────────────────────────────────────────────────
- 3 │ Signature 'AMM' (Audio Manager Module)
- ──────┼───────────────────────────────────────────────────────────────────
- 1 │ Character 1Ah. (End Of File marker).
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Version of AM tracker used. LO=Minor HI=Major. 0205h = 2.05.
- │ Since there ain't any AM tracker yet (maybe will never be one),
- │ set this version to 0.
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Info
- │ Bit 0 1=Set MOD note range limit. (Octave 1-6) (MOD)
- │ (S3M uses limit 2-5! But what the hell!)
- │ 1 Reserved
- │ 2 1=S3M effect bugs emulation
- │ 3 1=Force mono playback
- │ 4 1=Stereo music
- │ 4-13 Reserved. Set to 0.
- │ 14 0=Standard packed patterns 1=Extra packed
- │ (Bit 15 must be set for this bit to take effect)
- │ 15 0=Unpacked patterns (standard) 1=Packed
- ──────┼───────────────────────────────────────────────────────────────────
- 40 │ Song name.
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Number of Tracks (Suggested max = 32) (Also PP3 max)
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Number of patterns (Suggested max = 128. True max = 255)
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Number of samples (Suggested max = 128. True max = 255)
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Song length (number of orders) (Suggested max = 255)
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Master volume (Affects the note volume.) (S3M's Global vol)
- │ The resultant volume = (NoteVolume*MasterVolume)/64
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Amplification/Mixing mode. Controls amount of multiplication on
- │ resultant mixed sound wave. (S3M's Master volume)
- │ 0-32767 = Amplification. Observe the below chunk of code for signed
- │ samples multiplication. Note: This multiplication is not
- │ done on individual samples, but on the final resultant
- │ waveform to ensure quality and speed!
- │
- │ MOV AX,TheSignedSoundWaveWord
- │ IMUL AmplificationValue
- │ SAR AX,8
- │ (CLIP WAVEFORM HERE)
- │
- │ This is not the actual code in AudioManager/PP3. It's
- │ actually some sort more complicated.
- │ I realize that there are better methods other than
- │ this...but I dare not touch my code again!! Hahaha.
- │ For 16-bit waveform output, the amplification is multiplied
- │ by 256. (That means you can throw off the SAR AX,8 there).
- │
- │ 32768 = Quality SHIFT mode. Real quality shift value = Value-32768.
- │ -32775 0 being the loudest. This is a method faster than using
- │ master volume, but slower than the standard mixing mode.
- │ The final waveform is SHIFTED x-32768 number of bits to
- │ the right. (Div by exponents of 2).
- │
- │ 65535 = Standard mixing mode. Lowest quality, but ensures all sound
- │ are played correctly without clippings.
- ──────┼───────────────────────────────────────────────────────────────────
- 1 │ Startup speed (as in effect 1)
- ──────┼───────────────────────────────────────────────────────────────────
- 1 │ Startup tempo (as in effect 2)
- ──────┼───────────────────────────────────────────────────────────────────
- 1 │ Song source
- │ 0=Unknown
- │ 1=AM Tracker
- │ 2=MOD/NST
- │ 3=S3M
- │ 4=MTM
- │ 5=669
- ──────┼───────────────────────────────────────────────────────────────────
- │
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Number of bytes in extra data section (located after samples).
- │
- ──────┼───────────────────────────────────────────────────────────────────
- 13 │ Reserved
- ──────┼───────────────────────────────────────────────────────────────────
- UP TO HERE, HEADER IS 80 BYTES LONG
- AFTER THIS, ALMOST ALL DATA ARE VARIABLE SIZED
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Track pan flags. Each Track has one byte flag here.
- │ These Track flags contains the position of of Track at
- │ startup.
- │ 0 (Left most) 64 (Middle) 128 (Right)
- │ 255=Disabled Track 254=Surround (not supported yet)
- │ 129-137=Adlib channel 1-9. (NOT SUPPORTED YET & WILL CAUSE PROBLEMS)
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Pattern sequence. Each element is 2 bytes long.
- │ 65534=Skipped order (padding...S3M)
- │ 65535=End of song marker.
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Patterns in this format...
- │ All notes throughout the song are divided into Tracks.
- │ Therefore, patterns for Track 1 comes first, followed by Track 2,
- │ etc... There are 64 rows per pattern. Therefore, for one pattern
- │ of a one Track song, 5*64 = 320 bytes are required.
- │
- │ aaaabbbb cccccccc dddddddd 00yyyyyy zzzzzzzz
- │ BYTE 1 (255=No note, 254=Key off (stop sample))
- │ aaaa = Octave (0-7...maybe next time up to 15? :)
- │ bbbb = Note (0=C, 1=C#, etc... B=B)
- │ BYTE 2 (0=No sample/instrument)
- │ cccccccc = Instrument number (1=1st instrument, etc...)
- │ BYTE 3 dddddddd = Volume (0-64)
- │ BYTE 4 xx = Unused. Keep to 0.
- │ yyyyyy = Effect number
- │ BYTE 5 zzzzzzzz = Effect data
- │
- │ Value 255 is used throughout the patterns as no-data.
- │ Note 255 = No note (use previous)
- │ Volume 255 = No volume
- │ Sample 255 = No sample (use previous)
- │ Efx 255 = No efx
- │
- │ However, this method wastes alot of space, and thus, I've abandoned
- │ it (I still, however, use it in memory) for a new packed format.
- │ As before, each tracks are separated into separate blocks...
- │ For one Track, the format is as follows...
- │
- │ 4 Length of whole block, excluding these 4 bytes.
- │ x Event
- │ x Event
- │ x ..
- │ . ..
- │
- │ Each event is as follows...
- │ aa [bb] [cc] [dd] [ee & ff]
- │ BYTE 1 - Information byte
- │ BIT 0 1=Note & instrument present (Val 255=Use previous)
- │ 1 1=Volume present
- │ 2 1=Change in effect number
- │ 3 1=Change in effect data
- │ 7 1=Data present 0=Empty rows RLE encoded .
- │ If bit set, then Bit 0-6 = Number of empty rows-1.
- │ We do not have a signal for end of pattern because
- │ it isn't necessary, as each pattern must be 64-rows
- │ and if we reach more than 64 rows, it's time to
- │ increment the pattern count.
- │ This bit can save up to 128 empty rows with just
- │ one byte! :-) Now that's COOL! :-)
- │
- │ In Extended Compression mode (Bit 14 of info word)
- │ is set, this bit 7 may remain to be 0, but the next
- │ 3 bits after the events (bit 4-6) = number of empty
- │ rows follows this event, 0-7.
- │ aa = Info byte
- │ bb = Optional note number
- │ cc = Optional instrument number
- │ dd = Optional volume number
- │ ee = Optional effect number
- │ ff = Optional effect data
- │
- │ All of them can be present at one time, and after this info byte,
- │ it is followed by...
- │ 1-BYTE Note & Instrument number (if present)
- │ 1-BYTE Volume number (if present)
- │ 1-BYTE New effect number (if present)
- │ 1-BYTE New effect data (if present)
- │
- │ I used change in effect number as opposed to present effect because
- │ I notice many songs, particularly S3Ms by Purple Motion/Skaven
- │ uses a same effect for more than 1 row. (Esp. Vibrato,etc...)
- │ Thus, I took advantage of this to create smaller files.
- │ For each track, by startup, the previous effect and effect data are
- │ assumed to be 255 (no efx).
- │
- │ The RLE, however, *DOES NOT FALL INTO THIS CONTEXT*. It is purely
- │ meant for really empty tracks, with all it's values 255 in memory.
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Sample structure x NumberSamples (info for each sample)
- │ Each info is 80 bytes long and is identical to the AMS format.
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Sample data
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Special data (Author name, etc...)
- ──────┼───────────────────────────────────────────────────────────────────
- x │ Any other data that would not be loaded. :)
- ──────┼───────────────────────────────────────────────────────────────────
-
-
- AUDIO MANAGER SAMPLE (AMS)
- Bytes │ Stuff
- ──────┼───────────────────────────────────────────────────────────────────
- 3 │ Signature 'AMS' (Audio Manager Digital Sample)
- ──────┼───────────────────────────────────────────────────────────────────
- 1 │ Character 1Ah. (End Of File marker).
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Reserved for internal use. Used to store memory handle.
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Position within the memory block
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Reserved. TO BE USED IN SAMPLE LIBRARY AS POINTERS TO POS IN FILE.
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Length (NOTE! AMM can use samples much larger than 64k)
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Loop begin offset
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ Loop past offset (the offset right after the last byte in sample)
- ──────┼───────────────────────────────────────────────────────────────────
- 4 │ C2 Sample rate (8363 is the standard value) (Not C2 actually)
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Default playback rate (for SFX in games) ??????????????/
- ──────┼───────────────────────────────────────────────────────────────────
- 1 │ Volume (0-64)
- ──────┼───────────────────────────────────────────────────────────────────
- 2 │ Info
- │ Bit 0-1 Type. 00=Adlib 01=4 bit 10=8 bit 11=16 bit
- │ 4 bit samples are not linear, but logarithmic
- │ values based on internal tables.
- │ 2 0=Mono 1=Stereo (left right left right)
- │ 3 1=Looped (Loop past offset must not be 0)
- │ 4 0=Unsigned 1=Signed
- │ 5 0=Normal RAW samples 1=Delta-encoded samples
- │ 6-14 Reserved
- │ 15 0=Not loaded 1=Loaded
- │
- │
- │ Delta-Encoded samples use difference between two
- │ sample bytes/words to encode sample. This method,
- │ while produces the same file size, compresses
- │ better using a general purpose compressor, as
- │ their value ranges are usually small, which helps
- │ considerably the Huffman Coding compression algo.
- │
- │ RAW TO DELTA-ENCODED:
- │ The starting 'previous value' for each sample is 0.
- │ Then, as each sample element is taken, it is subtracted
- │ by 'PreviousValue'. The new 'previous value' is taken
- │ as the current sample value (not the delta-encoded val)
- │
- │ DELTA-ENCODED TO RAW:
- │ The starting 'previous value' for each sample is 0.
- │ Then, a delta-encoded sample is taken and added with
- │ 'previous value'. The new 'previous value' is taken
- │ as the current decoded value.
- ──────┼───────────────────────────────────────────────────────────────────
- 30 │ Sample name
- ──────┼───────────────────────────────────────────────────────────────────
- 13 │ Sample file name
- ──────┼───────────────────────────────────────────────────────────────────
-
- 80 TOTAL BYTES
-
-
- E F F E C T S
- -------------
-
- 00xx No effect
-
- 01xx Set speed
- 00 Use previous value
- Others Set speed. Default is 6.
-
- 02xx Set tempo (BPM)
- 00 Use previous value
- Others Set tempo (BPM) to xx. Default is 125.
-
- 03xx Set master volume (global volume in S3M)
- Set master volume. Varies from 0 to 64.
- Internally, it is multiplied by 4 for range of 0-256 used in AM3.
-
- 04xx Jump to order xx (hexadecimal)
- Jump to next order, at row 0 (if Pattern break was not set) or
- the row specified by pattern break if pattern break was set on
- the same line as this command.
-
- 05xx Pattern break to row xx (hexdecimal! Not decimal as in other formats)
- Jump to next order (if jump to order command was not used to set
- the next target order), row xx.
-
- 06xy Volume slide.
- 00 Continue previous (fine/slide)
- x0 Volume slide up by x
- 0y Volume slide down by y
- xF Fine volume slide up by x
- Fy Fine volume slide down by y
- FF Fine volume slide up by F (slide up has more priority).
-
- 07xy Slide up
- 00 Continue previous (extra/fine/slide)
- Ey Extra fine slide up with speed y.
- Fy Fine slide up with speed y.
- Others Slide up with speed xy (if xy not [extra] fine).
-
- 08xy Slide down
- 00 Continue previous (extra/fine/slide)
- Ey Extra fine slide down with speed y.
- Fy Fine slide down with speed y.
- Others Slide down with speed xy (if xy not [extra] fine).
-
- 09xx Slide to note
- 00 Continue slide with previous *slide to note* speed.
- xx Slide to note by with speed xx.
-
- 0Axy Vibrato
- 00 Continue previous.
- xy Vibrate pitch using active waveform with speed x and
- depth y.
- 0y Retains speed. Sets depth to y.
-
- 0Bxy Tremolo
- 00 Continue previous.
- Others Vibrate volume using active waveform with speed x and
- depth y.
-
- 0Cxy Arpeggio
- 00 Continue previous.
- Others Switch between 3 notes, including the current note quickly
- at every tick. Plays in the order... Current Note,
- Current Note+x semitones, Current Note+y semitones.
-
- 0Dxy Continue vibrato and do volume slide
- 00 Continue previous volume slide speed.
- Others Volume slide, with the same parameters as the normal volume
- slide.
-
- 0Exy Continue slide to note and do volume slide
- 00 Continue previous volume slide speed.
- Others Volume slide, with the same parameters as the normal volume
- slide.
-
- 0Fxx Set sample offset
- Sets sample offset to xx*256.
-
- 10xy Retrigger note [+ optional volume slide]
- Retriggers note and optionally do volume slide too.
- x=Volume slide type
- 0: 0 (No volumeslide)
- 1: -1
- 2: -2
- 3: -4
- 4: -8
- 5: -16
- 6: 2/3 times the original volume
- 7: 1/2 times the original volume
- 8: ?
- 9: +1
- A: +2
- B: +4
- C: +8
- D: +16
- E: 3/2 times the original volume
- F: 2 times the original volume
- Where the original volume is the CURRENT volume.
- y=Retrigger note at every y ticks.
-
- 11xx Set panning
- 00-128 Left(0) Middle(64) Right(128)
- 254 Surround (Not supported yet)
- 255 Disable channel
-
- 12xx Cut note
- 00 No cut
- Others Cut notes after xx ticks.
-
- 13xx Delay note
- 00 Note not played.
- Others Delays note and triggers it only after xx ticks.
-
- 14xy Tremor
- Turns sound on for x+1 ticks and off for y+1 ticks throughout
- the row.
-
- 15xx Pattern loop
- 00 Set start of loop
- Others Set end of loop and number of repetitions.
-
- 16xx Pattern delay
- 00 No delay
- Others Repeats current row x times without triggering the notes again,
- but applyin the effects.
-
- 17xx Set vibrato waveform to
- xx VALUES
- Waveform Name Retriggered No Retrigger
- ---------- ------------------- ----------- ------------
- /\ /\ Sine (default) 0 4
- \/ \/
-
- |\ |\ Ramp down 1 5
- \| \|
-
- ,-, ,-, Square 2 6
- '-' '-'
-
- ????????? Random 3 7
-
- Retrigger means that it will reset the position within the sine
- table everytime a new note is encountered. By default, the
- waveform is 0.
-
- 18xx Set tremolo waveform to xx.
- See 17xx, Set vibrato waveform.
-
- 19xx Set glissando (Slide to note will slide in halfnotes).
- 00 Disable glissando
- Others Enable glissando. Usually, people use value 1 for enabling
- glissando.
-
- 1Axx Set sample fine tune (set C-2's frequency)
- Set sample fine tune, where xx corresponds to the appropriate
- frequency of C-2.
- Values for X:
- 0 - 7895 Hz
- 1 - 7941 Hz
- 2 - 7985 Hz
- 3 - 8046 Hz
- 4 - 8107 Hz
- 5 - 8169 Hz
- 6 - 8232 Hz
- 7 - 8280 Hz
- 8 - 8363 Hz (No finetune)
- 9 - 8413 Hz
- A - 8463 Hz
- B - 8529 Hz
- C - 8581 Hz
- D - 8651 Hz
- E - 8723 Hz
- F - 8757 Hz
- To convert amiga fine tunes to current fine tune value,
- perform [(ADD 8) AND 1111b].
-
- 1Bxx Set filter
- Amiga hardware stuff (plays with Amiga LED or something).
- Not implemented.
-
- 1Cxx Set stereo control.
- An old Scream Tracker command. Not implemented.
-
- 1Dxx Invert loop (aka InvertFunk/FunkRepeat?)
- Plays sample backwards with speed xx. Not implemented.
-
- 1Exx Set event.
- Sets the event flag in AM3 and sets the value of AM.MI_Event to xx.
- Similar command in Scream Tracker is Zxx.
-
- 1Fxx Fine vibrato (S3M)
- Similar to Vibrato, but 4x finer.
-
-
- SUMMARY:
- MI@EFXnoEffect = 000h
- MI@EFXsetSpeed = 001h
- MI@EFXsetTempo = 002h
- MI@EFXsetMasterVolume = 003h
- MI@EFXpatternJump = 004h
- MI@EFXpatternBreak = 005h
- MI@EFXvolumeSlide = 006h
- MI@EFXslideUp = 007h
- MI@EFXslideDown = 008h
- MI@EFXslideToNote = 009h
- MI@EFXvibrato = 00Ah
- MI@EFXtremolo = 00Bh
- MI@EFXarpeggio = 00Ch
- MI@EFXvibrato_VolumeSlide = 00Dh
- MI@EFXslidetoNote_VolumeSlide = 00Eh
- MI@EFXsetSampleOffset = 00Fh
- MI@EFXretrigger = 010h
- MI@EFXsetPan = 011h
- MI@EFXcutNote = 012h
- MI@EFXdelayNote = 013h
- MI@EFXtremor = 014h
- MI@EFXpatternLoop = 015h
- MI@EFXpatternDelay = 016h
- MI@EFXsetVibratoWaveform = 017h
- MI@EFXsetTremoloWaveform = 018h
- MI@EFXsetGlissando = 019h
- MI@EFXsetFineTune = 01Ah
- MI@EFXsetFilter = 01Bh
- MI@EFXstereoControl = 01Ch
- MI@EFXinvertLoop = 01Dh
- MI@EFXevent = 01Eh
-